<template name="manageRoles">
    <div class="modal inmodal" id="manageRolesModal" tabindex="-1" role="dialog" aria-hidden="true"
         style="display: none;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                            class="sr-only">{{_ "close"}}</span></button>
                    <h4 class="modal-title">{{_ "manage_roles"}}</h4>
                    <small class="font-bold">{{_ "database"}} {{getDB}}
                    </small>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-12">
                            <table id="tblRoles"
                                   class="table table-striped table-bordered table-hover dataTables-example dataTable"
                                   style="width: 100%">
                                <thead>
                                <tr>
                                    <th>{{_ "role"}}</th>
                                    <th>{{_ "database"}}</th>
                                    <th>{{_ "is_builtin"}}</th>
                                    <th>{{_ "edit_view"}}</th>
                                    <th>{{_ "delete"}}</th>
                                </tr>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>

                            <button id="btnAddNewRole" type="button"
                                    class="btn btn-block btn-outline btn-primary"
                                    style="margin-top: 10px"
                                    data-toggle="modal"
                                    data-target="#editRoleModal">{{_ "add_role"}}
                            </button>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button id="btnCloseUMRoles" type="button"
                            data-style="contract"
                            class="btn btn-outline btn-primary ladda-button"
                            data-dismiss="modal">
                        {{_ "close"}}
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- ADD/EDIT ROLE MODAL -->
    <div class="modal inmodal" id="editRoleModal" tabindex="-1" role="dialog" aria-hidden="true"
         style="display: none;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                            class="sr-only">{{_ "close"}}</span></button>
                    <h4 id="addEditRoleModalTitle" class="modal-title">{{_ "edit_role"}}</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group"><label class="col-lg-2 control-label">{{_ "role"}}</label>
                            <div class="col-lg-10">
                                <input id="inputRoleUM" value="{{getRole.role}}" required="true"
                                       type="text"
                                       placeholder="{{_ "role"}}" class="form-control">
                            </div>
                        </div>
                    </form>

                    <div class="tabs-container">
                        <ul class="nav nav-tabs">
                            <li class="active"><a data-toggle="tab" href="#tab-1-role" aria-expanded="true">
                                {{_ "privileges"}}</a>
                            </li>
                            <li class=""><a data-toggle="tab" href="#tab-2-role" aria-expanded="false">{{_ "roles_to_inherit"}}</a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div id="tab-1-role" class="tab-pane active">
                                <div class="panel-body no-borders modal-background">
                                    <table id="tblRolePrivileges"
                                           class="table table-striped table-bordered table-hover dataTables-example dataTable"
                                           style="width: 100%">
                                        <thead>
                                        <tr>
                                            <th>{{_ "actions"}}</th>
                                            <th>{{_ "resource"}}</th>
                                            <th>{{_ "edit"}}</th>
                                            <th>{{_ "delete"}}</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>

                                    <button id="btnAddNewPrivilegeToRole" type="button"
                                            class="btn btn-block btn-outline btn-primary"
                                            style="margin-bottom: 10px">{{_ "add_privilege"}}
                                    </button>
                                </div>
                            </div>
                            <div id="tab-2-role" class="tab-pane">
                                <div class="panel-body no-borders modal-background">
                                    <table id="tblRolesToInherit"
                                           class="table table-striped table-bordered table-hover dataTables-example dataTable"
                                           style="width: 100%">
                                        <thead>
                                        <tr>
                                            <th>{{_ "role"}}</th>
                                            <th>{{_ "database"}}</th>
                                            <th>{{_ "delete"}}</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        </tbody>
                                    </table>

                                    <button id="btnAddNewInheritRoleToRole" type="button"
                                            class="btn btn-block btn-outline btn-primary"
                                            style="margin-bottom: 10px">{{_ "add_role_to_inherit"}}
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <div class="pull-left">
                        <button type="button" class="btn btn-white" data-dismiss="modal">{{_ "close"}}</button>
                    </div>
                    <button id="btnApplyAddEditRole" type="button"
                            data-style="contract"
                            class="btn btn-outline btn-primary ladda-button">
                        {{_ "save"}}
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- ADD/EDIT PRIVILEGE TO ROLE MODAL-->
    <div class="modal inmodal" id="addPrivilegeToRoleModal" tabindex="-1" role="dialog" aria-hidden="true"
         style="display: none;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                            class="sr-only">{{_ "close"}}</span></button>
                    <h4 id="addEditPrivilegeModalTitle" class="modal-title">{{_ "add_privilege"}}</h4>
                    <small id="addEditPrivilegeModalText" class="font-bold">{{_ "role"}}
                    </small>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group"><label class="col-lg-2 control-label">{{_ "db_resource"}}</label>
                            <div class="col-lg-10">
                                <select id="cmbPrivilegeResource"
                                        data-placeholder="{{_ "enter_or_choose_database"}}"
                                        class="chosen-select form-control"
                                        tabindex="-1">
                                    <option></option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group"><label class="col-lg-2 control-label">{{_ "collection"}}</label>
                            <div class="col-lg-10">
                                <select id="cmbPrivilegeCollection"
                                        data-placeholder="{{_ "enter_or_choose_collection"}}"
                                        class="chosen-select form-control"
                                        tabindex="-1">
                                    <option></option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">{{_ "actions"}}</label>
                            <div class="col-lg-10"><select id="cmbActionsOfPrivilege"
                                                           multiple="true"
                                                           data-placeholder="{{_ "action"}}"
                                                           class="chosen-select form-control"
                                                           tabindex="-1">
                            </select></div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <div class="pull-left">
                        <button type="button" class="btn btn-white" data-dismiss="modal">{{_ "close"}}</button>
                    </div>
                    <button id="btnApplyAddPrivilegeToRole"
                            type="button"
                            data-style="contract"
                            class="btn btn-outline btn-primary ladda-button">
                        Apply
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- ADD ROLE TO INHERIT MODAL-->
    <div class="modal inmodal" id="addRoleToInherit" tabindex="-1" role="dialog" aria-hidden="true"
         style="display: none;">
        <div class="modal-dialog modal-lg">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span
                            class="sr-only">{{_ "close"}}</span></button>
                    <h4>{{_ "add_role_to_inherit"}}</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <div class="form-group"><label class="col-lg-2 control-label">{{_ "database"}}</label>
                            <div class="col-lg-10">
                                <select id="cmbDatabasesForInheritRole"
                                        data-placeholder="{{_ "enter_or_choose_database"}}"
                                        class="chosen-select form-control"
                                        tabindex="-1">
                                    <option></option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group"><label class="col-lg-2 control-label">{{_ "role"}}</label>
                            <div class="col-lg-10">
                                <select id="cmbRolesForDBForInheritedRole"
                                        data-placeholder="{{_ "enter_or_choose_role"}}"
                                        class="chosen-select form-control"
                                        tabindex="-1">
                                    <option></option>
                                </select>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <div class="pull-left">
                        <button type="button" class="btn btn-white" data-dismiss="modal">{{_ "close"}}</button>
                    </div>
                    <button id="btnAddInheritRole"
                            type="button"
                            data-style="contract"
                            class="btn btn-outline btn-primary ladda-button">
                        Add
                    </button>
                </div>
            </div>
        </div>
    </div>
</template>